package com.sebiotec.basecommon.utils.tools;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.sebiotec.basecommon.R;

/**
 * @author Jake Han
 */
public class ToastTool {
    public static void showError(Context context,String message){
        View toastview= LayoutInflater.from(context).inflate(R.layout.toast_layout,null);
        TextView text = (TextView) toastview.findViewById(R.id.toast_text);
        text.setText(message);
        Toast toast=new Toast(context);
        toast.setGravity(Gravity.BOTTOM,0,40);
        toast.setDuration(Toast.LENGTH_SHORT);
        toast.setView(toastview);
        toast.show();
    }
    public static void showSuccess(Context context,String message){
        View toastview= LayoutInflater.from(context).inflate(R.layout.toast_layout1,null);
        TextView text = (TextView) toastview.findViewById(R.id.toast_text);
        text.setText(message);
        Toast toast=new Toast(context);
        toast.setGravity(Gravity.BOTTOM,0,40);
        toast.setDuration(Toast.LENGTH_SHORT);
        toast.setView(toastview);
        toast.show();
    }

}
